A New Top-Down Parsing Algorithm for Left-Recursive DCGs
نویسنده
چکیده
Abs t rac t . In this paper we introduce a new parsing algorithm, called cancellation parsing. Deterministic cancellation parsing with lookahead k can handle the C(k) grammars, which include the LL(k) grammars and are contained in the LC(k) grammars. The C(k) property is of theoretical interest in that it shows how to formalize the intuitive notion of the LL(k) property extended with the possibility of left recursion. The top-down nature of cancellation parsing gives it advantages over many other parsing algorithms. No analysis is needed to construct a nondeterministic cancellation parser. This makes cancellation parsing particularly useful for the implementation of definite clause grammars in Prolog environments.
منابع مشابه
A Simple Transformation for Offline-Parsable Grammars and its Termination Properties
We present, in easily reproducible terms, a simple transformation for offline-parsable grammars which results in a provably terminating parsing program directly top-down interpretable in Prolog. The transformation consists in two steps: (1) removal of empty-productions, followed by: (2) left-recursion elimination. It is related both to left-corner parsing (where the grammar is compiled, rather ...
متن کاملMaximizing Top-down Constraints for Unification-based Systems
A left-corner parsing algorithm with topdown filtering has been reported to show very efficient performance for unificationbased systems. However, due to the nontermination of parsing with left-recursive grammars, top-down constraints must be weakened. In this paper, a general method of maximizing top-down constraints is proposed. The method provides a procedure to dynamically compute *restrict...
متن کاملGuarded Attribute Grammars
Contrary to a widely-held belief, it is possible to construct executable specifications of language processors that use a top-down parsing strategy and which have structures that directly reflect the structure of grammars containing left-recursive productions. A novel technique has been discovered by which the non-termination that would otherwise occur is avoided by ‘guarding’ top-down left-rec...
متن کاملCompact non-left-recursive grammars using the selective left-corner transform and factoring
The left-corner transform removes left-recursion from (probabilistic) context-free grammars and unication grammars, permitting simple top-down parsing techniques to be used. Unfortunately the grammars produced by the standard left-corner transform are usually much larger than the original. The selective left-corner transform described in this paper produces a transformed grammar which simulates...
متن کاملTop-Down Predictive Linking and Complex-Feature-Based Formalisms
Automatic compilation of the linking relation employed in certain parsing algorithms for context-free languages is examined. Special problems arise in the extension of these algorithms to the possibly infinite domain of feature structures. A technique is proposed which is designed specifically for left-recursive categories and is based on the generalization of their occurrences in a derivation....
متن کامل